package com.example.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;

/**
 * 整合救援请求与救援行动的完整记录表
 * @TableName rescue_record
 */
@TableName(value ="rescue_record")
@Data
public class RescueRecord implements Serializable {
    /**
     * 主键ID，唯一标识救援记录
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 外键，关联用户表(user.id)，提交救援请求的用户
     */
    private Integer userId;

    /**
     * 动物位置（地址或经纬度，如：121.4737,31.2304）
     */
    private String location;

    /**
     * 动物现状描述（受伤、品种、毛色等）
     */
    private String animalCondition;

    /**
     * 用户提供的现场联系方式（可能与用户表联系方式不同）
     */
    private String contactInfo;

    /**
     * 外键，关联管理员表(admin.id)，处理救援的管理员（未处理时为NULL）
     */
    private Integer adminId;

    /**
     * 救援过程详细描述（工具、人员、行动步骤等）
     */
    private String actionDesc;

    /**
     * 救援结果：pending=待处理（默认状态）, rescued=成功, not_found=未找到, failed=失败
     */
    private Object result;

    /**
     * 用户提交请求的时间
     */
    private Date requestTime;

    /**
     * 管理员开始救援的时间
     */
    private Date startTime;

    /**
     * 救援行动结束的时间
     */
    private Date endTime;

    /**
     * 外键，关联宠物表(pet.id)，救援成功时创建的宠物记录（失败时为NULL）
     */
    private Integer petId;

    /**
     * 救援现场图片URL集合，存储JSON数组格式（如：["url1.jpg", "url2.jpg"]）
     */
    private Object images;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        RescueRecord other = (RescueRecord) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getLocation() == null ? other.getLocation() == null : this.getLocation().equals(other.getLocation()))
            && (this.getAnimalCondition() == null ? other.getAnimalCondition() == null : this.getAnimalCondition().equals(other.getAnimalCondition()))
            && (this.getContactInfo() == null ? other.getContactInfo() == null : this.getContactInfo().equals(other.getContactInfo()))
            && (this.getAdminId() == null ? other.getAdminId() == null : this.getAdminId().equals(other.getAdminId()))
            && (this.getActionDesc() == null ? other.getActionDesc() == null : this.getActionDesc().equals(other.getActionDesc()))
            && (this.getResult() == null ? other.getResult() == null : this.getResult().equals(other.getResult()))
            && (this.getRequestTime() == null ? other.getRequestTime() == null : this.getRequestTime().equals(other.getRequestTime()))
            && (this.getStartTime() == null ? other.getStartTime() == null : this.getStartTime().equals(other.getStartTime()))
            && (this.getEndTime() == null ? other.getEndTime() == null : this.getEndTime().equals(other.getEndTime()))
            && (this.getPetId() == null ? other.getPetId() == null : this.getPetId().equals(other.getPetId()))
            && (this.getImages() == null ? other.getImages() == null : this.getImages().equals(other.getImages()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getLocation() == null) ? 0 : getLocation().hashCode());
        result = prime * result + ((getAnimalCondition() == null) ? 0 : getAnimalCondition().hashCode());
        result = prime * result + ((getContactInfo() == null) ? 0 : getContactInfo().hashCode());
        result = prime * result + ((getAdminId() == null) ? 0 : getAdminId().hashCode());
        result = prime * result + ((getActionDesc() == null) ? 0 : getActionDesc().hashCode());
        result = prime * result + ((getResult() == null) ? 0 : getResult().hashCode());
        result = prime * result + ((getRequestTime() == null) ? 0 : getRequestTime().hashCode());
        result = prime * result + ((getStartTime() == null) ? 0 : getStartTime().hashCode());
        result = prime * result + ((getEndTime() == null) ? 0 : getEndTime().hashCode());
        result = prime * result + ((getPetId() == null) ? 0 : getPetId().hashCode());
        result = prime * result + ((getImages() == null) ? 0 : getImages().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", userId=").append(userId);
        sb.append(", location=").append(location);
        sb.append(", animalCondition=").append(animalCondition);
        sb.append(", contactInfo=").append(contactInfo);
        sb.append(", adminId=").append(adminId);
        sb.append(", actionDesc=").append(actionDesc);
        sb.append(", result=").append(result);
        sb.append(", requestTime=").append(requestTime);
        sb.append(", startTime=").append(startTime);
        sb.append(", endTime=").append(endTime);
        sb.append(", petId=").append(petId);
        sb.append(", images=").append(images);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}